UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lqelAF8BwHUxUuBYDLAkd7P7S9bDcDoWOkYHngmuFlo=' 
WHERE 
  key_id = 'f12e31b28a248fec0bf727a7c3e88636b648b41e5513937ca634503609c1ba57' 
  AND (
    token = 'lqelAF8BwHUxUuBYDLAkd7P7S9bDcDoWOkYHngmuFlo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030