UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6yLF0arqh9KsjYJqQF68lNmFSGlH46zIFKeQSu4vNV4='
WHERE
key_id = '2cf3baa47953e5bf4ef5483bdab0b9355f790deab3d95a0e8d3374006d7a5601'
AND (
token = '6yLF0arqh9KsjYJqQF68lNmFSGlH46zIFKeQSu4vNV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)