UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+gs5WFnap/cfemAVozFqjoCcwaW5e2kE/GI7OJpFFJo='
WHERE
key_id = '39ad0a02cc7a8acadbcff9d098844f40736399d5a6ce085487142511f4057014'
AND (
token = '+gs5WFnap/cfemAVozFqjoCcwaW5e2kE/GI7OJpFFJo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)