UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NotcgGS29PAQGuiqKyTC9AbCIhzrGNLDlP4DXTVaEGc='
WHERE
key_id = 'be25a23156eb54fa43f3eb05fcbf875bf6b75e13940866b9c83135f43bee5ae4'
AND (
token = 'NotcgGS29PAQGuiqKyTC9AbCIhzrGNLDlP4DXTVaEGc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)