UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RFXAelTbEClomGjRgplgbh3fz9zVuBrXdac80IKFYDE=' 
WHERE 
  key_id = 'a21cddb69336c48055fe09bccee5a4080a1f82f705b124375257f022f8626e2c' 
  AND (
    token = 'RFXAelTbEClomGjRgplgbh3fz9zVuBrXdac80IKFYDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019