UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y64aasqoOKw61BfS4jQWPijOxzKvGPoyqouRQ0c/fsA=' 
WHERE 
  key_id = '00a5297fc38295d4c64ad04a669037f4208d034e27c5d08463c0b4e94bf19e45' 
  AND (
    token = 'Y64aasqoOKw61BfS4jQWPijOxzKvGPoyqouRQ0c/fsA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029