UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0iIYUMDcxzQXk+gR7pPbE4mYHujbatnitXYvVK8QcYI='
WHERE
key_id = 'ef36781dc5f80bfe57be225f3b35ce417812604c673755cbce80650db14e3239'
AND (
token = '0iIYUMDcxzQXk+gR7pPbE4mYHujbatnitXYvVK8QcYI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)