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