UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nQfVRyxqwvG/B47GEoGCN5NLzieQi30vWuN7mOfGP4Y=' 
WHERE 
  key_id = '500e02d9674a7df1153907a5b9d40a72ea8ffff14957ce8e1a5946065ee65546' 
  AND (
    token = 'nQfVRyxqwvG/B47GEoGCN5NLzieQi30vWuN7mOfGP4Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027