UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YDSsa18tHJpQnAywvBrCeiidLnqS5yZDs9CGq/0Ent0='
WHERE
key_id = '0ff1097238ca638e942d44c0369b13e139fa996e4e3b5ee20986bbc1162bea2f'
AND (
token = 'YDSsa18tHJpQnAywvBrCeiidLnqS5yZDs9CGq/0Ent0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)