UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iBLEG8y8XMuwaoh83T15TbpEOT2OyZlgKtO211PUQ4Y=' 
WHERE 
  key_id = '1a6c0e0d8fd78d393a254bfbfb507d51e3013273a73e0a92b0ab340c2764866e' 
  AND (
    token = 'iBLEG8y8XMuwaoh83T15TbpEOT2OyZlgKtO211PUQ4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027