UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qWSl8DgqtGpCsOTZ0FiVuJLAzIqEYWoCQhJ0khSgx0E=' 
WHERE 
  key_id = '506540aaddf429362ba21034e3d89d3814abf2994ca7d769bf90b1f369001d00' 
  AND (
    token = 'qWSl8DgqtGpCsOTZ0FiVuJLAzIqEYWoCQhJ0khSgx0E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029