UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nWJnf1J47xRCFhUKOQS31NPWhhLsnGzVEQR8OU8vDXw='
WHERE
key_id = '7dc12b58e5b90a42fd752bf820352435f8210b5f8a1d8510c754fcb027802a4d'
AND (
token = 'nWJnf1J47xRCFhUKOQS31NPWhhLsnGzVEQR8OU8vDXw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)