UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FTFGBT6eMhnrC5Etcx4V+dcKUPtcbw+X4hBDS4Hkwck=' 
WHERE 
  key_id = '7940834402c456e7d5040bb8a05e50d640dda650fdc98bb1bf9cfe0b5de8360a' 
  AND (
    token = 'FTFGBT6eMhnrC5Etcx4V+dcKUPtcbw+X4hBDS4Hkwck=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022