UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/G5gLYRM14rU7yeKGXKZoCGWCha5IlMANm1VJU4y5Gg='
WHERE
key_id = 'a38550c34eef11049d355afc031b9a88f69149e86227571c4b77950d5028ae53'
AND (
token = '/G5gLYRM14rU7yeKGXKZoCGWCha5IlMANm1VJU4y5Gg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)