UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ph7Hqv94XVXROdlP9+RvTWYnzO5bokMS5hPs+fluBO0='
WHERE
key_id = '6b61065fe4d8e63253c4366f4b57099cbd392f806cda803d17a5a2c2ddd09708'
AND (
token = 'Ph7Hqv94XVXROdlP9+RvTWYnzO5bokMS5hPs+fluBO0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)