UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '//1ydRK7tIb5Ox4jUexEyDMbSx1MGj0HmfbmaP1ux+Y='
WHERE
key_id = 'c5b3f967164638b144eb19f022b5a9dd28dd58dc5c738ede313616e9d80d93d6'
AND (
token = '//1ydRK7tIb5Ox4jUexEyDMbSx1MGj0HmfbmaP1ux+Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)