UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZVBVAmygr0sKU5SOOKtdaQ0YkeiN6gw3WS6j7+lKi3s=' 
WHERE 
  key_id = 'da6049bacaa445d522d268a4f31f02f87ed228f39998cd5ca4c1d657f8e35323' 
  AND (
    token = 'ZVBVAmygr0sKU5SOOKtdaQ0YkeiN6gw3WS6j7+lKi3s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027