UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WYWC8IZECG8b4kx35zKmlyfZirNh0UMXxu0aABCM+Hk='
WHERE
key_id = '991a3ba5b0399c69960a206b9351bd086a7180b9ae1904cd4ce22dee13336171'
AND (
token = 'WYWC8IZECG8b4kx35zKmlyfZirNh0UMXxu0aABCM+Hk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)