UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SIFhf3UI+KtHdMgJgYkf0czqepZCMdCjtREXOIIyNlY='
WHERE
key_id = 'a4927e76c219bff62964953faf7f9165614e6fef1953e1331f43c095b9224d1a'
AND (
token = 'SIFhf3UI+KtHdMgJgYkf0czqepZCMdCjtREXOIIyNlY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)