UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IJMFu9qMFbkDolGsQMDcT+eLFAYdheT3bMYyVO0Fffs=' 
WHERE 
  key_id = '9d4df7c74defc1ef570eef595f20af402208c1e0c4135382e84d70d7703ae050' 
  AND (
    token = 'IJMFu9qMFbkDolGsQMDcT+eLFAYdheT3bMYyVO0Fffs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028