UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u1LTBL1Y1qf7ScRGkuDDKISanhr1Wc6pWGBGVX3jbnE=' 
WHERE 
  key_id = '39a577846489c403748b21f942c25010aed0085e3976f12d5cb7a062ac5f004d' 
  AND (
    token = 'u1LTBL1Y1qf7ScRGkuDDKISanhr1Wc6pWGBGVX3jbnE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022