UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L3tVi+sWdGxtA2RIyZUB7er0meydMxjOoWiWhzP5YwQ=' 
WHERE 
  key_id = '8727dc004252be30c292abe5b36eb7513992d8f7dd88a1f33946adb6bd14e840' 
  AND (
    token = 'L3tVi+sWdGxtA2RIyZUB7er0meydMxjOoWiWhzP5YwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056