UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bGed4opJO1NW5zHbBrhCYEsig0uuF5UX6uX49I+N9vs='
WHERE
key_id = '1b6f216f438fdd38b13687fc3e5a7f9c6ff2bf6929ebc1a6b2911e1170dacfcc'
AND (
token = 'bGed4opJO1NW5zHbBrhCYEsig0uuF5UX6uX49I+N9vs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)