UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ffKZNZXeyZstq36jmt02ai9G6Wkk+G0bj4uIn8hCTrI=' 
WHERE 
  key_id = '49ddd3f1e7ff991f92aaaad458d68a8092ffe7125eac0557f816b7b5435aa3d5' 
  AND (
    token = 'ffKZNZXeyZstq36jmt02ai9G6Wkk+G0bj4uIn8hCTrI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038