UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HB674Whx5VRwBFARhD1XjzYFlHysdGT9zD9y1pEhW0s='
WHERE
key_id = 'fa5e7c4e792a3947a6ff3278df704e73705b8def272eaed195168aa113a50534'
AND (
token = 'HB674Whx5VRwBFARhD1XjzYFlHysdGT9zD9y1pEhW0s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)