UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ahm8wrLWtnRmR+cyG3aOdrjQtSrXj17fEGa8oUPPffg='
WHERE
key_id = 'f87c8d532e658138aeba3d95f949502f8d327b1e6f5f4a38225aeeb35812a263'
AND (
token = 'ahm8wrLWtnRmR+cyG3aOdrjQtSrXj17fEGa8oUPPffg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)