UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AwH97Yr3BJjESvUgGk6ZhJIxH93mkubJ5m4wZdHc4iw=' 
WHERE 
  key_id = '51a37925b1e28a6b985ffa74cfbea49e530cfd3b21acc8dcd54e56c4e0227462' 
  AND (
    token = 'AwH97Yr3BJjESvUgGk6ZhJIxH93mkubJ5m4wZdHc4iw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025