UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CZF7qW6TcZVbhofNsnyp31K40zws6O7fEDAkT7VOT+U='
WHERE
key_id = 'e14e057b31626d13872866a3c726dd6fb1616ddf53b23e578bcbfb6cd913ab88'
AND (
token = 'CZF7qW6TcZVbhofNsnyp31K40zws6O7fEDAkT7VOT+U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)