UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lb0UBja9GtSOvIRzyr1PMUJRf/OdmfsNBhzUg83w/VQ=' 
WHERE 
  key_id = '949a9108b35f113f5f0b1ad2c7eb0d617cae7dc2007d6ddb195405e4f96c6279' 
  AND (
    token = 'lb0UBja9GtSOvIRzyr1PMUJRf/OdmfsNBhzUg83w/VQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035