UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZzkSeH2LFgOHSxbniYMpD5la5NytsEZrJWEfeHrO0Nc=' 
WHERE 
  key_id = '53939d859fa874f1025f81736625e9d5da3e1e604815b5112eff15b068cc3315' 
  AND (
    token = 'ZzkSeH2LFgOHSxbniYMpD5la5NytsEZrJWEfeHrO0Nc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040