UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'L4gw50fMJe139urwtn16hgJWkr0ucQsMN9wRvDXtCMM='
WHERE
key_id = '1cae786162482fe184149242a096c7b48a705e518a913075df4ce31d9df2d969'
AND (
token = 'L4gw50fMJe139urwtn16hgJWkr0ucQsMN9wRvDXtCMM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)