UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Z6IHPiL/AdSPzaSxECFT8cyQZI8wbDHlvTEyu3BtF1w=' 
WHERE 
  key_id = '7baadb3c3dc2f94ac17f87771923a3a5d3232a3efe28ab23ab4533fb727131ea' 
  AND (
    token = 'Z6IHPiL/AdSPzaSxECFT8cyQZI8wbDHlvTEyu3BtF1w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031