UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EcqT7wJBdVaScIL0QP7htH0pHqJatDFE+h3nLD/bQug=' 
WHERE 
  key_id = 'edae1f19031798e32983d9636a229f49b595ba3f42572b8215a1bcf89dc08527' 
  AND (
    token = 'EcqT7wJBdVaScIL0QP7htH0pHqJatDFE+h3nLD/bQug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048