UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '47wYH1i9GEeXC4wgd/D1mDLLelvd83sfUba7HLWl71M='
WHERE
key_id = 'e0d39cc09b83d04748167b13301cb3e49e379f3a8b5b6ee91084a1523ad73a70'
AND (
token = '47wYH1i9GEeXC4wgd/D1mDLLelvd83sfUba7HLWl71M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)