UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HENn6IkYCJ4rLV7L+jfFHNOH3aKazzn0R+y+Wv0z1u0='
WHERE
key_id = '9487ecfbb21f4dd8b09abdad4371e4c53d92444792571818d010077dda2c3639'
AND (
token = 'HENn6IkYCJ4rLV7L+jfFHNOH3aKazzn0R+y+Wv0z1u0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)