UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ahtK3Hy1261puGhJ48atISLi5rFr+9D2RImh40h4qxU='
WHERE
key_id = 'c6f31a525b78199f26e4a3a27511cd66706b8ca6b814ed6c80a083a10dd8943d'
AND (
token = 'ahtK3Hy1261puGhJ48atISLi5rFr+9D2RImh40h4qxU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)