UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o0l/EqmAuxdmIf70+peGJBkVoIhMA4mQwUdl+Q5nYHg=' 
WHERE 
  key_id = '475fd2abc258898723f0284d80ca498964037a1ce009f550fed44fc615a0c4a8' 
  AND (
    token = 'o0l/EqmAuxdmIf70+peGJBkVoIhMA4mQwUdl+Q5nYHg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045