UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c+FI8x0zccWSGaLiAfwR1TRM8QnicOZow8B4R3NThr0=' 
WHERE 
  key_id = 'dc344053492f7ff9eab1d7d791f912f7f7145c58542afb6bf30ab33ee5a6e5fe' 
  AND (
    token = 'c+FI8x0zccWSGaLiAfwR1TRM8QnicOZow8B4R3NThr0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032