UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dU+dDgMQ8CxQXutpzJbwyBF2ARASmFthAPZPg1oXNxs='
WHERE
key_id = 'b4f16ef396f47a2b5a2795c8bb39b6898a281b8866835109158389d6ec8633ac'
AND (
token = 'dU+dDgMQ8CxQXutpzJbwyBF2ARASmFthAPZPg1oXNxs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)