UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i7YH2jkdXp7wOSwLUQWtIhIQb6v1W+xlSYTdXaLbnzA=' 
WHERE 
  key_id = 'f5f2c7a72e1c14364e4226967c68049cfafcf9a593173f1c5d272b01d1c1bb87' 
  AND (
    token = 'i7YH2jkdXp7wOSwLUQWtIhIQb6v1W+xlSYTdXaLbnzA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022