UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'F8iBs6r+ktVILvzlYNJxlaXnSgR+7A9bzHh1DCITRK4=' 
WHERE 
  key_id = '65522ae22a5e8796193cc226fbb4390170071668814fae6d5852fd2950e663c1' 
  AND (
    token = 'F8iBs6r+ktVILvzlYNJxlaXnSgR+7A9bzHh1DCITRK4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041