UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'p/gHANXqx9b6IxWzXM55gWj/tmquVNJcamSnaYFLFOM=' 
WHERE 
  key_id = '7d9f1fc50d6a60563cee767a2a4dd5fcedc49a8bbdb9461d403ff559a0bab919' 
  AND (
    token = 'p/gHANXqx9b6IxWzXM55gWj/tmquVNJcamSnaYFLFOM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047