UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f2JFAGjyVonluuDE8dIlM2ygDXUwLTEAeWHgKSVM4F0='
WHERE
key_id = '9ed2db72421bd57a50c17671b9497c20c9ac60dace54636c2caf5b34f843afa4'
AND (
token = 'f2JFAGjyVonluuDE8dIlM2ygDXUwLTEAeWHgKSVM4F0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)