UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M2KgM2LbpX+kHanAk/RPMtAOSwskvkAPrmtf77yUFZ8=' 
WHERE 
  key_id = '0dd6b5dc8bf12a18f45b718a0e6d97c8779a1d833fef9266a93046b5b13f9037' 
  AND (
    token = 'M2KgM2LbpX+kHanAk/RPMtAOSwskvkAPrmtf77yUFZ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032