UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'klg+FeTiJlT55yal8g5gbzmynDBXviGdmUXFNNOuocY=' 
WHERE 
  key_id = '5881293122f7e5fd593bbd92c33df00dc0cb6de03e79410d074c77a133631aa6' 
  AND (
    token = 'klg+FeTiJlT55yal8g5gbzmynDBXviGdmUXFNNOuocY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041