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

Query time 0.00020