UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vVMPTKhKY7SRbzD8747tWrRW1o/AnhqpfaEssjrXjzY=' 
WHERE 
  key_id = 'd1733ea3a1371d6950d71d56da42169f22af3758ae124d397b17f074055b3477' 
  AND (
    token = 'vVMPTKhKY7SRbzD8747tWrRW1o/AnhqpfaEssjrXjzY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039