UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hIEw62riUHIl3KTNach8UukN8U2hjwg4VuVAZhR0hig=' 
WHERE 
  key_id = '907acad7c3c393af309b62149f51fd31c1573dba3e40f5fdd75942db28427ed5' 
  AND (
    token = 'hIEw62riUHIl3KTNach8UukN8U2hjwg4VuVAZhR0hig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00080