UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JC3zTs+5XlYIvlnbnfW6tRqlGC0wVEKcmshYG2M6BXk='
WHERE
key_id = 'd00374a7de5f34d3d7b95804c804bcb41a9f61c6c0b8a980cc3d9eb54324f0da'
AND (
token = 'JC3zTs+5XlYIvlnbnfW6tRqlGC0wVEKcmshYG2M6BXk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)